package com.rituo.lock.utils;

import com.rituo.lock.RedisScript;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * @author lid
 * @date 2019-08-06 16:35
 */
@Component
public class LockUtils {
    @Resource
    private StringRedisTemplate stringRedisTemplate;

    @Resource
    private RedisScript redisScript = RedisScript.getInstance();

    public void lock() throws Exception{
        List<String> keys = Arrays.asList("w", "y");
        Boolean execute = stringRedisTemplate.execute(redisScript.lockScript, keys);

        System.out.println(execute);
    }

}
